
Bullet = class("Bullet");

function Bullet:ctor(firePoint, speed)
    --self对应的对象的实例本身的表

    self.gameObject = newObject(ThunderManager.prefabs[2]);
    self.transform = self.gameObject.transform;

    self.transform.position=firePoint.position;
    self.transform.rotation=firePoint.rotation;

    self.rigid = self.gameObject:GetComponent('Rigidbody2D');
    self.rigid.velocity = firePoint.up*speed;

    local luaTrigger = self.gameObject:AddComponent(typeof(LuaRigidTrigger));
    luaTrigger:AddHandler(self.OnTriggerEnter2D,self);

    --销毁 自己子弹（1秒）
    GameObject.Destroy(self.gameObject,1)
end